<html>
<head>
<script src="formValidation.js"></script>
<title>Appointment Scheduling System</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>

<div id='body_container'>
	<div id="header"><div id='banner'>NITC Appoinmtent Scheduling System</div></div>
	<div id='menu'>
	<div id="tabs"><a href="home.php">Home</a><a href="online.php">Available Faculties</a><a href="message.php">Request Appointment</a><a href="logout.php">Logout</a></div>
	</div>
	<div id='page_container'>
<div id="page">
<div class='page_contents'>
<div class='heading'>Request An Appointment</div>
<?php
	session_start();
	if(isset($_SESSION['email'])) 
	{
		include 'dbconnect.php';
		if(isset($_REQUEST['send']))
		{ 
			$to = $_REQUEST['to'];
			$msg = $_REQUEST['comment'];
			$time = $_REQUEST['time'];
			$uid1 = $_SESSION['email'];
			$day = $_REQUEST['day'];
			$mon = $_REQUEST['month'];
			$year = $_REQUEST['year'];
			$hour = $_REQUEST['hours'];
			$min = $_REQUEST['minutes'];
			$dateTime = $day. '/' . $mon . '/' . $year . ' ' . $hour . ':' . $min;
			$dtime = DateTime::createFromFormat("d/m/Y H:i", $dateTime);
			$timestamp = $dtime->getTimestamp();
			$qu="insert into msglog values('$uid1','$to','$msg','0','0','$timestamp') ";
			$re=mysql_query($qu) or die("query error");
			header("location:home.php");
		}	

	}
	else {
	header("location:index.php");
	}
?>


<form name="appointment" action="message.php" onSubmit="return validateAppointment()" class="request_form">
	<table align="center" cellspacing=10>
		<tr>
			<td>To:</td>
			<td><input type="text" name="to"></td>
		</tr>
		<tr>
			<td style='vertical-align:top;padding-top:10px;'>Message:</td>
			<td>
				<textarea name="comment" ></textarea>
			</td> 
			<td>
				Date:
				<select name="day">
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5">5</option>
					<option value="6">6</option>
					<option value="7">7</option>
					<option value="8">8</option>
					<option value="9">9</option>
					<option value="10">10</option>
					<option value="11">11</option>
					<option value="12">12</option>
					<option value="13">13</option>
					<option value="14">14</option>
					<option value="15">15</option>
					<option value="16">16</option>
					<option value="17">17</option>
					<option value="18">18</option>
					<option value="19">19</option>
					<option value="20">20</option>
					<option value="21">21</option>
					<option value="22">22</option>
					<option value="23">23</option>
					<option value="24">24</option>
					<option value="25">25</option>
					<option value="26">26</option>
					<option value="27">27</option>
					<option value="28">28</option>
					<option value="29">29</option>
					<option value="30">30</option>
					<option value="31">31</option>
				</select>
				<select name="month">
					<option value="1">January</option>
					<option value="2">February</option>
					<option value="3">March</option>
					<option value="4">April</option>
					<option value="5">May</option>
					<option value="6">June</option>
					<option value="7">July</option>
					<option value="8">August</option>
					<option value="9">September</option>
					<option value="10">October</option>
					<option value="11">November</option>
					<option value="12">December</option>
				</select>
				<select name="year">
					<option value="2013">2013</option>
					<option value="2014">2014</option>
					<option value="2015">2015</option>
				</select>
				<br/>
				Time:
				<select name="hours">
					<option value="00">00</option>
					<option value="01">01</option>
					<option value="02">02</option>
					<option value="03">03</option>
					<option value="04">04</option>
					<option value="05">05</option>
					<option value="06">06</option>
					<option value="07">07</option>
					<option value="08">08</option>
					<option value="09">09</option>
					<option value="10">10</option>
					<option value="11">11</option>
					<option value="12">12</option>
					<option value="13">13</option>
					<option value="14">14</option>
					<option value="15">15</option>
					<option value="16">16</option>
					<option value="17">17</option>
					<option value="18">18</option>
					<option value="19">19</option>
					<option value="20">20</option>
					<option value="21">21</option>
					<option value="22">22</option>
					<option value="23">23</option>
				</select>
				<select name="minutes">
					<option value="00">00</option>
					<option value="15">15</option>
					<option value="30">30</option>
					<option value="45">45</option>
				</select>

			</td>
		</tr>
		<tr>
			<td></td>
			<td> <input type="submit" name="send" value="Send Request"></td> 
		</tr>
	</table>
</form>
</div>
</div>
</div>
<?php include 'footer.php'; ?>
</div>
</body>
</html>
